package com.lap.framework.common.tool;

import java.util.UUID;
import lombok.experimental.UtilityClass;
import org.apache.commons.lang3.StringUtils;

@UtilityClass
public class Uid {

  /** 生成带连字符的标准UUID (8-4-4-4-12) */
  public static String getStandardId() {
    return UUID.randomUUID().toString();
  }

  /** 生成紧凑型UUID (32位无连字符) */
  public static String getCompactId() {
    return UUID.randomUUID().toString().replace("-", "");
  }

  /** 生成带前缀的ID (如 "user-xxxxxxxx") */
  public static String getPrefixedId(String prefix) {
    return ((StringUtils.isNotBlank(prefix)) ? prefix + "-" : "") + getCompactId();
  }
}
